<?php
/**
 * Geneone: Content Management Framework
 * Object Namespace Search
 *
 * @package Geneone
 * @author Khlo
 * @version 1.0
 * @copyright 2004-2006 Geneone Development Team
 */
 
require_once ('Gene/Search.php');
require_once ('Gene/Search/Result/User.php');
 
class Gene_Search_Source_User {
	/**
	 * Runs a search using the specified phrase and options.
	 *
	 * @var string $phrase Search Phrase
	 * @var array $options Specific Search Options
	 *
	 * @return object Gene_Search_Result object. PEAR_Error on failure.
	 */
	function &getSearch($phrase, $options=array()) {
		$db =& Gene::getDatabase();
		
		if (!$phrase) {
			$result = PEAR::raiseError("No search terms provided.");
		} else {
			$q = $db->prepare("SELECT name, bio FROM ".Gene::tableName("user_info")." p WHERE name LIKE ? ORDER BY name ASC");
			$res = $q->execute(array('%'.$phrase.'%'));
			
			$result = new Gene_Search_Result_User($res, $phrase);
		}
		
		return $result;
	}
}
 
?>